Add OpenCode shell plugin#613
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new opencode shell plugin to integrate the OpenCode CLI with 1Password Shell Plugins by provisioning/importing an API key via OPENCODE_API_KEY.
Changes:
- Introduces the OpenCode plugin definition (platform metadata, credentials, and executable).
- Adds an API key credential type wired to
OPENCODE_API_KEYwith provisioner/importer support. - Adds unit tests covering the API key provisioner and importer.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| plugins/opencode/plugin.go | Defines the plugin metadata and registers its credential/executable. |
| plugins/opencode/opencode.go | Declares the opencode executable, docs link, auth requirements, and credential usage. |
| plugins/opencode/api_key.go | Implements the API key credential, env var mapping, provisioner, and importer. |
| plugins/opencode/api_key_test.go | Tests env var provisioning and importing for OPENCODE_API_KEY. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scottisloud
left a comment
There was a problem hiding this comment.
Thanks for adding OpenCode support!
One blocking change before merge:
NeedsAuthshould skipopencode authsubcommands. Right nowopencode auth login,list, andlogoutwould still require a 1Password item first, which blocks the documented setup flow for users who have not configured the plugin yet. Please addneedsauth.NotWhenContainsArgs("auth")alongside the existing helpers inopencode.go(same pattern asplugins/cline/cline.goandplugins/upstash/upstash.go).
Optional polish (not blocking):
- The field description could note this is an OpenCode Zen API key from opencode.ai/auth and that
OPENCODE_API_KEYcovers only the Zen gateway, not BYOK keys likeANTHROPIC_API_KEY. - Credential
DocsURLcould point at the Providers / OpenCode Zen section instead of the intro page.
Once the auth exclusion is in, I'll take another look!
scottisloud
left a comment
There was a problem hiding this comment.
Thanks again for making these changes and for the contribution @eddumelendez ! LGTM
Look out for this in a future version of the 1Password CLI.
Overview
Adds a new OpenCode shell plugin for the
opencodeCLI.The plugin provisions an auth token through
OPENCODE_API_KEY. It also supports importing an existing token fromOPENCODE_API_KEY.Type of change
Related Issue(s)
N/A
How To Test
Run plugin validation:
Run the OpenCode plugin tests:
go test ./plugins/opencodeExample authenticated command for functional testing:
opencode run "explain this repo"Changelog
Authenticate the OpenCode CLI using Touch ID and other unlock options with 1Password Shell Plugins.